<!DOCTYPE html>
<html>
  	<head>
	    <title>云平台帐号绑定</title>
	    <meta name="keywords" content="keyword1,keyword2,keyword3">
	    <meta name="description" content="Newton">
	    <meta name="content-type" content="text/html; charset=UTF-8">
		<meta charset="UTF-8" name="viewport"
			content="width=device-width,initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
		<link type="text/css" rel="stylesheet" href="/cloud_ifw/js/layer/mobile/need/layer.css"/>
		<script type="text/javascript" src="/cloud_ifw/js/jquery/jquery.min.js"></script>
		<script type="text/javascript" src="/cloud_ifw/js/layer/mobile/layer.js"></script>
		<style>
		body {
			margin: 0;
			background-color: #fffff5;
		}
		
		.H05REM {
			height: 0.5rem;
		}
		
		.H1REM {
			height: 1rem;
		}
		
		.H2REM {
			height: 2rem;
		}
		
		.bindYunId {
		}
		
		.bindYunId .bindTip {
			text-align: center;
			font-size: 0.875rem;
		}
		
		.bindYunId .bindInputDiv {
		}
		
		.bindYunId .bindInputDiv .bindInput {
			margin-left: 4rem;
			width: 10rem;
			height: 2rem;
			line-height: 2rem;
			color: #666;
			font-size: 0.75rem;
			background-color: white;
			border-radius: 1rem;
			padding: 0 1rem;
			border: 1px solid #ccc;
		}
		
		.bindYunId .bindSubmitDiv {
		}
		
		.bindYunId .bindSubmitDiv .bindSubmit {
			margin-left: 7rem;
			width: 6rem;
			height: 2rem;
			line-height: 1.8rem;
			color: #fff;
			font-size: 0.75rem;
			border-radius: 1rem;
			padding: 0 1rem;
			border: 0.1rem solid #398439;
			background-color: #449d44;
		}
		
		</style>
		<script>
		$(function() {
			layer.open({
				type: 2,
				title: "",
				content: "正在初始化，请稍等",
				shadeClose: false
			});
			init();
			var url = "/cloud_ifw/weixin/getisopenid.action";
			$.post(url, {
			}, function(data) {
				if(data.success && data.result && data.result.isOpenid) {
					layer.closeAll();
					return;
				}
				var param = {
					pageName: "/mobi/bindYunId.html"
				};
				location.href = "/cloud_ifw/weixinauth/wxopenid.action?param=" + JSON.stringify(param);
			}, "json");
		});
		
		function init() {
			var width = $(window).width();
			$('html').css('font-size', (width / 20) + 'px');
			
			var is_choose_img = false;
			$('#bindSubmit').click(function() {
				var yunId = $('#bindInput').val();
				if(!yunId) {
					alert("请输入云平台帐号");
					return;
				}
				layer.open({
					type: 2,
					title: "",
					content: "正在绑定，请稍等",
					shadeClose: false
				});
				var url = "/cloud_ifw/member/wchatyunmobi_bind.action";
				$.post(url, {
					yunId: yunId
				}, function(data) {
					layer.closeAll();
					if(data.success && data.result) {
						alert("绑定成功");
					} else {
						var errors = "绑定失败，请重试";
						if(data.result && data.result.errors)
							errors = data.result.errors;
						alert(errors);
						location.reload();
					}
				}, "json");
			});
			
		}
		</script>
  	</head>
  	<body>
  		<div id="bindYunId" class="bindYunId">
  			<div class="H2REM"></div>
  			<div class="H2REM"></div>
  			<div class="bindTip">请输入您的云平台帐号</div>
  			<div class="H2REM"></div>
  			<div class="bindInputDiv">
  				<input type="text" id="bindInput" class="bindInput" maxlength="32"/>
  			</div>
  			<div class="H1REM"></div>
  			<div class="bindSubmitDiv">
  				<input type="button" id="bindSubmit" class="bindSubmit" value="绑定">
  			</div>
  		</div>
  	</body>
</html>
